﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Koala.Pro.Models;
using Koala.Pro.Services;
using System.Windows.Media;

namespace Koala.Pro.ViewModels
{
    public partial class DashboardViewModel : ObservableObject
    {
        [ObservableProperty]
        private int _counter;

        [ObservableProperty]
        private List<TopStatusItem> topDashBoards;

        [ObservableProperty]
        private List<Member> members;

        private bool isInit;

        private readonly IWindowsProviderService windowsService;

        public DashboardViewModel(IWindowsProviderService windowsService)
        {
            if (!isInit)
            {
                InitDashBoards();
                InitMembers();
                isInit = true;
            }
            this.windowsService = windowsService;
        }

        private void InitDashBoards()
        {
            TopDashBoards = new List<TopStatusItem>
        {
            new TopStatusItem
            {
                Title = "新订阅金额",
                Logo = "/Assets/dashboardItem1.png",
                Amount = 0m,
                BackgroundGradientStart = "#f59083",
                BackgroundGradientEnd = "#fae188"
            },
            new TopStatusItem
            {
                Title = "新租户",
                Logo = "/Assets/dashboardItem2.png",
                Amount = 10m,
                BackgroundGradientStart = "#ff7272",
                BackgroundGradientEnd = "#f650c5"
            },
            new TopStatusItem
            {
                Title = "样例统计",
                Logo = "/Assets/dashboardItem3.png",
                Amount = 250m,
                BackgroundGradientStart = "#5e7cea",
                BackgroundGradientEnd = "#1dcce3"
            },
            new TopStatusItem
            {
                Title = "样例统计",
                Logo = "/Assets/dashboardItem4.png",
                Amount = 350m,
                BackgroundGradientStart = "#255ea6",
                BackgroundGradientEnd = "#b350d1"
            }
        };
        }

        private void InitMembers()
        {
            BrushConverter brushConverter = new BrushConverter();
            Members = new List<Member>
            {
                new Member
                {
                    Number = "1",
                    Character = "J",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1098AD"),
                    Name = "John Doe",
                    Position = "Coach",
                    Email = "john.doe@gmail.com",
                    Phone = "415-954-1475"
                },
                new Member
                {
                    Number = "2",
                    Character = "R",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Reza Alavi",
                    Position = "Administrator",
                    Email = "reza110@hotmail.com",
                    Phone = "254-451-7893"
                },
                new Member
                {
                    Number = "3",
                    Character = "D",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF8F00"),
                    Name = "Dennis Castillo",
                    Position = "Coach",
                    Email = "deny.cast@gmail.com",
                    Phone = "125-520-0141"
                },
                new Member
                {
                    Number = "4",
                    Character = "G",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Gabriel Cox",
                    Position = "Coach",
                    Email = "coxcox@gmail.com",
                    Phone = "808-635-1221"
                },
                new Member
                {
                    Number = "5",
                    Character = "L",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Lena Jones",
                    Position = "Manager",
                    Email = "lena.offi@hotmail.com",
                    Phone = "320-658-9174"
                },
                new Member
                {
                    Number = "6",
                    Character = "B",
                    BgColor = (Brush)brushConverter.ConvertFromString("#6741D9"),
                    Name = "Benjamin Caliword",
                    Position = "Administrator",
                    Email = "beni12@hotmail.com",
                    Phone = "114-203-6258"
                },
                new Member
                {
                    Number = "7",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF6D00"),
                    Name = "Sophia Muris",
                    Position = "Coach",
                    Email = "sophi.muri@gmail.com",
                    Phone = "852-233-6854"
                },
                new Member
                {
                    Number = "8",
                    Character = "A",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Ali Pormand",
                    Position = "Manager",
                    Email = "alipor@yahoo.com",
                    Phone = "968-378-4849"
                },
                new Member
                {
                    Number = "9",
                    Character = "F",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Frank Underwood",
                    Position = "Manager",
                    Email = "frank@yahoo.com",
                    Phone = "301-584-6966"
                },
                new Member
                {
                    Number = "10",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Saeed Dasman",
                    Position = "Coach",
                    Email = "saeed.dasi@hotmail.com",
                    Phone = "817-320-5052"
                },
                new Member
                {
                    Number = "11",
                    Character = "J",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1098AD"),
                    Name = "John Doe",
                    Position = "Coach",
                    Email = "john.doe@gmail.com",
                    Phone = "415-954-1475"
                },
                new Member
                {
                    Number = "12",
                    Character = "R",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Reza Alavi",
                    Position = "Administrator",
                    Email = "reza110@hotmail.com",
                    Phone = "254-451-7893"
                },
                new Member
                {
                    Number = "13",
                    Character = "D",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF8F00"),
                    Name = "Dennis Castillo",
                    Position = "Coach",
                    Email = "deny.cast@gmail.com",
                    Phone = "125-520-0141"
                },
                new Member
                {
                    Number = "14",
                    Character = "G",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Gabriel Cox",
                    Position = "Coach",
                    Email = "coxcox@gmail.com",
                    Phone = "808-635-1221"
                },
                new Member
                {
                    Number = "15",
                    Character = "L",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Lena Jones",
                    Position = "Manager",
                    Email = "lena.offi@hotmail.com",
                    Phone = "320-658-9174"
                },
                new Member
                {
                    Number = "16",
                    Character = "B",
                    BgColor = (Brush)brushConverter.ConvertFromString("#6741D9"),
                    Name = "Benjamin Caliword",
                    Position = "Administrator",
                    Email = "beni12@hotmail.com",
                    Phone = "114-203-6258"
                },
                new Member
                {
                    Number = "17",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF6D00"),
                    Name = "Sophia Muris",
                    Position = "Coach",
                    Email = "sophi.muri@gmail.com",
                    Phone = "852-233-6854"
                },
                new Member
                {
                    Number = "18",
                    Character = "A",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Ali Pormand",
                    Position = "Manager",
                    Email = "alipor@yahoo.com",
                    Phone = "968-378-4849"
                },
                new Member
                {
                    Number = "19",
                    Character = "F",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Frank Underwood",
                    Position = "Manager",
                    Email = "frank@yahoo.com",
                    Phone = "301-584-6966"
                },
                new Member
                {
                    Number = "20",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Saeed Dasman",
                    Position = "Coach",
                    Email = "saeed.dasi@hotmail.com",
                    Phone = "817-320-5052"
                },
                new Member
                {
                    Number = "21",
                    Character = "J",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1098AD"),
                    Name = "John Doe",
                    Position = "Coach",
                    Email = "john.doe@gmail.com",
                    Phone = "415-954-1475"
                },
                new Member
                {
                    Number = "22",
                    Character = "R",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Reza Alavi",
                    Position = "Administrator",
                    Email = "reza110@hotmail.com",
                    Phone = "254-451-7893"
                },
                new Member
                {
                    Number = "23",
                    Character = "D",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF8F00"),
                    Name = "Dennis Castillo",
                    Position = "Coach",
                    Email = "deny.cast@gmail.com",
                    Phone = "125-520-0141"
                },
                new Member
                {
                    Number = "24",
                    Character = "G",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Gabriel Cox",
                    Position = "Coach",
                    Email = "coxcox@gmail.com",
                    Phone = "808-635-1221"
                },
                new Member
                {
                    Number = "25",
                    Character = "L",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Lena Jones",
                    Position = "Manager",
                    Email = "lena.offi@hotmail.com",
                    Phone = "320-658-9174"
                },
                new Member
                {
                    Number = "26",
                    Character = "B",
                    BgColor = (Brush)brushConverter.ConvertFromString("#6741D9"),
                    Name = "Benjamin Caliword",
                    Position = "Administrator",
                    Email = "beni12@hotmail.com",
                    Phone = "114-203-6258"
                },
                new Member
                {
                    Number = "27",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF6D00"),
                    Name = "Sophia Muris",
                    Position = "Coach",
                    Email = "sophi.muri@gmail.com",
                    Phone = "852-233-6854"
                },
                new Member
                {
                    Number = "28",
                    Character = "A",
                    BgColor = (Brush)brushConverter.ConvertFromString("#FF5252"),
                    Name = "Ali Pormand",
                    Position = "Manager",
                    Email = "alipor@yahoo.com",
                    Phone = "968-378-4849"
                },
                new Member
                {
                    Number = "29",
                    Character = "F",
                    BgColor = (Brush)brushConverter.ConvertFromString("#1E88E5"),
                    Name = "Frank Underwood",
                    Position = "Manager",
                    Email = "frank@yahoo.com",
                    Phone = "301-584-6966"
                },
                new Member
                {
                    Number = "30",
                    Character = "S",
                    BgColor = (Brush)brushConverter.ConvertFromString("#0CA678"),
                    Name = "Saeed Dasman",
                    Position = "Coach",
                    Email = "saeed.dasi@hotmail.com",
                    Phone = "817-320-5052"
                }
            };
        }

        [RelayCommand]
        private void OnCounterIncrement()
        {
            //Counter++;
            //windowsService.ShowDialog<InputForm>();
        }

        [RelayCommand]
        private void RegisterForm()
        {
            //windowsService.Show<RegisterForm>();
        }
    }
}
